version: "3.9"

services:
  fastapi_app:
    container_name: fastapi_app
    image: sorxill/tracker:test_base
    env_file:
      - .env-docker
    volumes:
      - ./src:/app/src
    ports:
      - "4000:4000"
    build: .
    restart: on-failure
    command: sh /app/docker/app.sh

  fastapi_db:
    container_name: fastapi_db
    image: postgres:16.1-alpine3.19
    environment:
      POSTGRES_USER: "${DB_USER}"
      POSTGRES_PASSWORD: "${DB_PASS}"
      POSTGRES_DB: "${DB_NAME}"
    ports:
      - "5432:5432"
    volumes:
      - pgdata:/var/lib/postgresql/data

volumes:
  pgdata: {}
